package com.szrt.day20170424;


import java.io.File;

import org.junit.Test;

public class FileTest {
	
	
	/**
	 * File这个类作用等于于 侦察兵  就是用来侦测对人到底是一个文件还是文件夹
	 * @throws Exception
	 */
	@Test
	public void fileTest() throws Exception {
		
		File file = new File("c:/lyl/zdb.txt");
		
		System.out.println(file.getName());
		
		System.out.println(file.isFile());;
		
		System.out.println(file.isDirectory());
		
		System.out.println(file.canWrite());
		
	}
	
	
	@Test
	public void directoryTest() throws Exception {
		
		//File file = new File("c:/lyl/zdb.txt");
		File file = new File("c:/lyl/sunliansheng");
		
		System.out.println(file.getName());
		
		System.out.println(file.isFile());;
		
		System.out.println(file.isDirectory());
		
		
		
	}

}
